<!DOCTYPE html>
<html lang="en" layout:decorator="layout/main" xmlns:layout="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width,user-scalable=no,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,initial-scale=1"/>

    <link rel="stylesheet" th:href="@{/thirdParty/datatables/dataTables.bootstrap.css}" />
    <link rel="stylesheet" th:href="@{/thirdParty/iCheck/all.css}" />

    <title>订单管理</title>
</head>
<body>
        <section class="content" layout:fragment="content">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">订单管理</h3>
                    </div>
                    <div class="col-xs-12">
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body table-responsive">
                        <form class="form-inline">
                            <div class="form-group">
                                <label>订单号：</label>
                                <input type="text" class="form-control J_orderNo" placeholder="订单号"></input>
                            </div>
                            <div class="form-group">
                                <label>店铺名称：</label>
                                <input type="email" class="form-control" placeholder="店铺名称" ></input>
                            </div>
                            <div class="form-group">
                                <label>用户电话号码：</label>
                                <input type="email" class="form-control" placeholder="用户电话号码" ></input>
                            </div>
                            <div class="form-group">
                                <label>订单状态：</label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" id="inlineCheckbox1" value="option2"> 创建订单</input>
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" id="inlineCheckbox2" value="option2"> 待指派订单</input>
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" id="inlineCheckbox3" value="option2"> 配送中订单</input>
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" id="inlineCheckbox4" value="option2"> 确认收货订单</input>
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" id="inlineCheckbox5" value="option2"> 已评价订单</input>
                                </label>
                            </div>
                            <div class="form-group">
                                <label>付款方式：</label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" id="inlineCheckbox6" value="option1"> 微信支付</input>
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" id="inlineCheckbox7" value="option1"> 支付宝支付</input>
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" id="inlineCheckbox8" value="option1"> 水票支付</input>
                                </label>
                            </div>
                            <button type="submit" class="btn btn-default">搜索</button>
                        </form>
                        <table id="datasOnTable" class="table table-bordered table-hover table-responsive">
                            <thead>
                            <tr>
                                <th><nobr>订单号</nobr></th>
                                <th><nobr>订单来源</nobr></th>
                                <th><nobr>下单时间</nobr></th>
                                <th><nobr>商品规格</nobr></th>
                                <!--<th><nobr>单价</nobr></th>-->
                                <th><nobr>数量</nobr></th>
                                <th><nobr>合计金额/元</nobr></th>
                                <th><nobr>支付方式</nobr></th>
                                <th><nobr>水票使用</nobr></th>
                                <th><nobr>用户</nobr></th>
                                <th><nobr>收货人</nobr></th>
                                <th><nobr>所属区域</nobr></th>
                                <th><nobr>收货地址</nobr></th>
                                <th><nobr>商铺名称</nobr></th>
                                <th><nobr>商铺地址</nobr></th>
                                <th><nobr>电话</nobr></th>
                                <th><nobr>状态</nobr></th>
                                <th><nobr>处理时间</nobr></th>
                                <th><nobr>操作员</nobr></th>
                                <th><nobr>备注13</nobr></th>
                            </tr>
                            </thead>
                            <tbody>

                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>


            <!--dialog-->
            <!--<div class="modal inmodal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">-->
                <!--<div class="modal-dialog">-->
                    <!--<div class="modal-content animated bounceInRight">-->
                        <!--<form role="form" class="form-horizontal" id="updateFrom" th:action="@{/admin/user/updateUser}" method="post">-->
                            <!--<div class="modal-header">-->
                                <!--<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>-->
                                <!--<i class="fa fa-laptop modal-icon"></i>-->
                                <!--<h4 id="AAA" class="modal-title">Modal title</h4>-->
                            <!--</div>-->
                            <!--<div class="modal-body col-xs-12">-->

                                <!--<div class="col-xs-12">-->
                                    <!--<input type="hidden" name="userId" id="userId"/>-->
                                    <!--<div class="form-group">-->
                                        <!--<label for="cnName">用户名称</label>-->
                                        <!--<input type="text" class="form-control" id="cnName" name="cnName" placeholder="输入用户名称" />-->
                                    <!--</div>-->
                                    <!--<div class="form-group">-->
                                        <!--<div th:each="r,iterStat : ${roles}">-->
                                            <!--<label>-->
                                                <!--<input type="radio" name="roleId" th:id="${'radio'+r.id}" th:value="${r.id}" class="flat-red" />-->
                                            <!--</label>-->
                                            <!--<label><p th:text="${r.description}"></p></label>-->
                                        <!--</div>-->
                                    <!--</div>-->
                                <!--</div>-->

                            <!--</div>-->
                            <!--<div class="modal-footer">-->
                                <!--<button type="button" class="btn btn-white" data-dismiss="modal">Close</button>-->
                                <!--<button type="button" id="saveBtn" class="btn btn-primary">Save changes</button>-->
                            <!--</div>-->
                        <!--</form>-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->
        </section>

    <div layout:fragment="script">
        <script th:src="@{/thirdParty/datatables/jquery.dataTables.min.js}"></script>
        <script th:src="@{/thirdParty/datatables/dataTables.bootstrap.min.js}"></script>
        <script th:src="@{/thirdParty/iCheck/icheck.min.js}" />
        <script th:src="@{/thirdParty/jquery.form.js}" />
        <script>
            $(function () {
                //Flat red color scheme for iCheck
                $('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({
                    checkboxClass: 'icheckbox_flat-green',
                    radioClass: 'iradio_flat-green'
                });
                var data = {
                    queryInfoMsg:{
                        shopName:"喜腾官方旗舰店"
                    }
                };
                $("#datasOnTable").dataTable(
                        {
                            "filter" : false,//去掉搜索框
                            "ordering" : false,
                            "lengthChange": false,
                            "paginationType" : "full_numbers",
                            "destroy" : true,
                            "processing" : true,
                            "serverSide" : false,
                            "ajax" : {
                                "type":"POST",
                                "url" :  ctx+"admin/order/list2",
                                "dataSrc":"content",
                                "dataFilter": function(data){
                                    console.log(data);
                                    var json = jQuery.parseJSON( data );
                                    json.recordsTotal = json.totalElements;
                                    json.recordsFiltered = json.totalElements;
                                    return JSON.stringify( json ); // return JSON string
                                },
                                "data": function(){
                                    return JSON.stringify(data);
                                },
                                "contentType":'application/json; charset=utf-8',
                                "error" : function(data){
                                    console.log(data)
//                                    alert("请求数据出错");
                                }
                            },
                            "columns" : [
                                {"data" : "orderNo"},
                                {"data" : "orderSource"},
                                {"data" : "createTime"},
                                {"data" : "productItems"},
//                                {"data" : "onePrice"},
                                {"data" : "buyAmount"},
                                {"data" : "totalPrice"},
                                {"data" : "payChannel"},
                                {"data" : "ticketUseNum"},
                                {"data" : "userInfo"},
                                {"data" : "receiver"},
                                {"data" : "cityName"},
                                {"data" : "deliveryAddress"},
                                {"data" : "shopName"},
                                {"data" : "shopAddress"},
                                {"data" : "shopTelephone"},
                                {"data" : "status"},
                                {"data" : "operateTime"},
                                {"data" : "operator"},
                                {"data" : "remark"}
                            ],
                            "language" : {
                                "url" : ctx+'thirdParty/datatables/dataTables.CN.txt'
                            }
                        });

            });




            function toAdd(){
                console.log("123");
                changeDialog(0);
            }

            //编辑确认按钮
            $("#saveBtn").bind("click",function() {
                $("#updateFrom").ajaxSubmit({
                    success:function(){
                        alert("成功");
                        $('#myModal').modal('hide');
                    },
                    error: function (xhr, status, error) {
                        var result = jQuery.parseJSON(xhr.responseText);
                        alert(result.message);
                    }
                });

            });

            function changeDialog(id){
                console.log(id);
                if(id!=0) {
                    $("#userId").val(id);
                }
                var zTreeObj;
                $.ajax({type:"get",
                    url:ctx+"admin/user/detail/"+id,
                    data:{},
                    dataType:"json",
                    error: function(){
                        alert("系统忙，请稍后再试！");
                    },
                    success:function(json){
                        console.log(json.cnName);
                        $("#cnName").val(json.cnName);
                        $("#radio"+json.roleId).iCheck('check');
                    }
                });
            }
        </script>
    </div>


</body>
</html>